package com.cn.controller;

import com.cn.pojo.Order;
import com.cn.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 添加单个订单
     * @return 1表示成功，0表示失败
     */
    public int addOrder(Order order) {
        return orderService.addOrder(order);
    }
    /**
     * 根据用户名和商品名添加订单
     */
    public int addOrderByName(String username, String productName, int count) {
        return orderService.addOrderByName(username, productName, count);
    }
}
